package com.example.jwtdemo.service.impl;

import com.example.jwtdemo.mapper.UserMapper;
import com.example.jwtdemo.pojo.User;
import com.example.jwtdemo.service.UserService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;

/**
 * @author HMQ
 * @date 2020/9/20 14:39
 */
@Service
@Transactional
public class UserServiceImpl implements UserService {
    @Resource
    private UserMapper userMapper;

    @Override
    public User login(User user) {
        User userDb = userMapper.login(user);
        if (userDb != null) {
            return userDb;
        }
        throw new RuntimeException("登录失败！");
    }
}
